package com.agileplex.codeminer.scm.svn;

import java.io.IOException;

import org.apache.log4j.Logger;

import com.agileplex.codeminer.index.IndexBuilder;
import com.agileplex.codeminer.scm.IRepository;
import com.agileplex.codeminer.scm.IRepositoryListener;
import com.agileplex.codeminer.scm.IVersion;

/**
 * Listener for Subversion
 * 
 * @creator Weiming Yin
 * @date 2007-7-17
 *
 * @lastmodified
 * @author $Author: yinweiming $
 * @version $Revision: 15 $, $Date: 2007-07-16 18:12:59 +0000 (Mon, 16 Jul 2007) $
 */
public class SvnReposListener implements IRepositoryListener {
	static Logger logger = Logger.getLogger(SvnReposListener.class);
	
	public void processRepository(ScmStatus status, IRepository repos, IVersion v) {
		if (status == ScmStatus.VERSION_READY) {
			try {
				IndexBuilder.buildIndex(repos, v);
			} catch (IOException e) {
				logger.error(e);
				//TODO: weiming -- recover the error later.
			}
		}
	}

}
